<img alt="Twoje dane" src="images/admin.png" id="adminIkona" />

<div data-dojo-type="dijit/form/DropDownButton" baseClass="adminButton">
	<span>${loggedUser.imie} ${loggedUser.nazwisko}</span>
	<div data-dojo-type="dijit/TooltipDialog">
		<h2 style="margin:0px; padding: 0px; text-align: center; color: #212A6E; font-weight: bold; ">Edycja twoich danych</h2>
	    <table cellspacing="10">
	        <tr>
	            <td>
	                <label for="imie">Imie:</label> 
	            </td>
	            <td>
	                <input type="text" id="imie" name="form.imie" required="true" value="${loggedUser.imie}" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
	        <tr>
	            <td>
	                <label for="nazwisko">Nazwisko:</label> 
	            </td>
	            <td>
	                <input type="text" id="nazwisko" name="form.nazwisko" required="true" value="${loggedUser.nazwisko}" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
	        <tr>
	            <td>
	                <label for="nazwisko">Login:</label> 
	            </td>
	            <td>
	                <input type="text" id="login" name="form.login" required="true" value="${loggedUser.login}" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
	        <tr>
	            <td>
	                <label for="wordSite">Strona WORD:</label> 
	            </td>
	            <td>
	                <input type="text" id="stronaWord" name="form.stronaWord" required="true" value="${loggedUser.stronaWord}" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
	        <tr>
	            <td>
	                <label for="haslo">Nowe hasło:</label> 
	            </td>
	            <td>
	                <input type="password" id="haslo" name="form.haslo" required="true" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
	        <tr>
	            <td>
	                <label for="haslo2">Powtórz hasło:</label> 
	            </td>
	            <td>
	                <input type="password" id="haslo2" name="form.haslo2" required="true" data-dojo-type="dijit/form/ValidationTextBox"/>
	            </td>
	         </tr>
			<tr><td><button data-dojo-type="dijit/form/Button" type="submit" onclick="sendForm()";>Zapisz</button></td></tr>
		</table>
	</div>
</div>
<script>
var sendForm = function() {
	require([ "dojo/ready","dijit/Dialog", "dojo/dom", 'modules/ep'], function(ready, dialog, dom, ep) {
		var queryObject = {
			"form.imie": dom.byId('imie').value,
			"form.nazwisko": dom.byId('nazwisko').value,
			"form.login": dom.byId('login').value,
			"form.stronaWord": dom.byId('stronaWord').value,
			"form.haslo": dom.byId('haslo').value,
			"form.haslo2": dom.byId('haslo2').value
		};
		
		ep.requestPost('user!save.action', queryObject, function(response) {
			ep.showMsgExecuteAfterClose(response, function() {
				window.location.reload();
			});
		});
		
	});
}
</script>